#region Using

using System;

#endregion

namespace SemanticEngine.Apml
{
	public class Concept : ItemBase
	{

		#region Constructors

		public Concept()
		{
		}

		public Concept(string name)
		{
			Init(name, 0.5D, default(string), DateTime.MinValue, DataType.Implicit);
		}

		public Concept(string name, double rank)
		{
			Init(name, rank, default(string), DateTime.MinValue, DataType.Implicit);
		}

		public Concept(string name, double rank, string from)
		{
			Init(name, rank, from, DateTime.Now, DataType.Implicit);
		}

		public Concept(string name, double rank, string from, DateTime dateUpdated)
		{
			Init(name, rank, from, dateUpdated, DataType.Implicit);
		}

		public Concept(string name, double rank, string from, DateTime dateUpdated, DataType dataType)
		{
			Init(name, rank, from, dateUpdated, dataType);
		}

		#endregion

		#region Private methods

		private void Init(string name, double rank, string from, DateTime dateUpdated, DataType dataType)
		{
			_Name = name;
			base.Rank = rank;
			base.From = from;
			base.DateUpdated = dateUpdated;
			_DataType = dataType;
		}

		/// <summary>
		/// Validates this instance.
		/// </summary>
		protected override void Validate()
		{
			base.Validate();
			AddRule("Name", "The name of a Concept must be specified", string.IsNullOrEmpty(Name));
		}

		/// <summary>
		/// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
		/// </summary>
		/// <returns>
		/// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
		/// </returns>
		public override string ToString()
		{
			return Name;
		}

		#endregion

		#region Properties

		private string _Name;
		/// <summary>
		/// Gets or sets the name of the concept/interest.
		/// </summary>
		/// <value>The name of the concept/interest.</value>
		public string Name
		{
			get { return _Name; }
			set { _Name = value; }
		}

		private DataType _DataType;

		public DataType DataType
		{
			get { return _DataType; }
			set { _DataType = value; }
		}

		#endregion

	}
}
